        $(function () {
            $('.nav-bar > li').on('mouseover', function () {
                $(this).children('.nav_left').slideDown(300);
            })

            $('.nav-bar > li').on('mouseleave', function () {
                $(this).children('.nav_left').stop(true, false).slideUp();
            })
        })
        
        //验证token
        function fun() {
            var token = sessionStorage.getItem("token");
            if (token == '' || token == 'undefined' || token == undefined || token == NaN || token == 'NaN') {
                window.location.href = "login.html";
                return false;
                alert("true");
            }
            return true;
            alert("true");
        }


        //手风琴
        (function () {
            $(".news_content dl.news_classify_1").mouseover(function () {
                var index = $(".news_content").find("dl.hover").index();
                if (index == 0) {
                    return false;
                } else if (index == 1) {
                    $(".news_content dl.news_classify_2").stop().animate({ left: '40%' });
                } else if (index == 2) {
                    $(".news_content dl.news_classify_2").stop().animate({ left: '40%' });
                    $(".news_content dl.news_classify_3").stop().animate({ left: '60%' });
                } else if (index == 3) {
                    $(".news_content dl.news_classify_2").stop().animate({ left: '40%' });
                    $(".news_content dl.news_classify_3").stop().animate({ left: '60%' });
                    $(".news_content dl.news_classify_4").stop().animate({ left: '80%' });
                }
                $(".news_content dl").removeClass("hover");
                $(this).addClass("hover").addClass("hover");
            });

            $(".news_content dl.news_classify_2").mouseover(function () {
                var index = $(".news_content").find("dl.hover").index();
                if (index == 1) {
                    return false;
                } else if (index == 0) {
                    $(".news_content dl.news_classify_2").stop().animate({ left: '20%' });
                } else if (index == 2) {
                    $(".news_content dl.news_classify_3").stop().animate({ left: '60%' });
                } else if (index == 3) {
                    $(".news_content dl.news_classify_3").stop().animate({ left: '60%' });
                    $(".news_content dl.news_classify_4").stop().animate({ left: '80%' });
                }
                $(".news_content dl").removeClass("hover");
                $(this).addClass("hover").addClass("hover");
            });

            $(".news_content dl.news_classify_3").mouseover(function () {
                var index = $(".news_content").find("dl.hover").index();
                if (index == 2) {
                    return false;
                } else if (index == 0) {
                    $(".news_content dl.news_classify_2").stop().animate({ left: '20%' });
                    $(".news_content dl.news_classify_3").stop().animate({ left: '40%' });
                } else if (index == 1) {
                    $(".news_content dl.news_classify_3").stop().animate({ left: '40%' });
                } else if (index == 3) {
                    $(".news_content dl.news_classify_4").stop().animate({ left: '80%' });
                }
                $(".news_content dl").removeClass("hover");
                $(this).addClass("hover").addClass("hover");
            });

            $(".news_content dl.news_classify_4").mouseover(function () {
                var index = $(".news_content").find("dl.hover").index();
                if (index == 3) {
                    return false;
                } else if (index == 0) {
                    $(".news_content dl.news_classify_2").stop().animate({ left: '20%' });
                    $(".news_content dl.news_classify_3").stop().animate({ left: '40%' });
                    $(".news_content dl.news_classify_4").stop().animate({ left: '60%' });
                } else if (index == 1) {
                    $(".news_content dl.news_classify_3").stop().animate({ left: '40%' });
                    $(".news_content dl.news_classify_4").stop().animate({ left: '60%' });
                } else if (index == 2) {
                    $(".news_content dl.news_classify_4").stop().animate({ left: '60%' });
                }
                $(".news_content dl").removeClass("hover");
                $(this).addClass("hover").addClass("hover");
            });
        })();

        // ajax请求新闻动态
        (function () {
            function delHtmlTag(str) {
                return str.replace(/<[^>]+>/g, "");//去掉所有的html标记
            }
            var params00 = {
                'apiKey': 'api_post_getAllNews',
                'deviceType': 'DIC_DEVICE_TYPE_1',
                contentType: "application/json;charset=utf-8",
                datatype: 'json'
            };
            var params11 = {
                'apiKey': 'api_post_getAllIndustryDynamics',
                'deviceType': 'DIC_DEVICE_TYPE_1',
                contentType: "application/json;charset=utf-8",
                datatype: 'json'
            };
            var params22 = {
                'apiKey': 'api_post_getAllLatestFuels',
                'deviceType': 'DIC_DEVICE_TYPE_1',
                contentType: "application/json;charset=utf-8",
                datatype: 'json'
            };
            var params33 = {
                'apiKey': 'api_post_getAllActivityDiscounts',
                'deviceType': 'DIC_DEVICE_TYPE_1',
                contentType: "application/json;charset=utf-8",
                datatype: 'json'
            };
            ajax("POST", '/d_easy/deasy/api', params00, 'json', function (data) { // POST或GET请求直接传参
                var first = data.newslist;
                var time = first[0].update_time;
                var years = time.slice(0, 7);
                var day = time.slice(8, 10);
                $(".news_classify_1 dt p").text(first[0].title_name);
                $(".news_classify_1 dt i").text(years);
                $(".news_classify_1 dt em").text(day);
                $(".news_classify_1 dd p").text(delHtmlTag(first[0].content));
            })
            ajax("POST", '/d_easy/deasy/api', params11, 'json', function (data) {
                var first = data.industrylist;
                var time = first[0].update_time;
                var years = time.slice(0, 7);
                var day = time.slice(8, 10);
                $(".news_classify_2 dt p").text(first[0].title_name);
                $(".news_classify_2 dt i").text(years);
                $(".news_classify_2 dt em").text(day);
                $(".news_classify_2 dd p").text(delHtmlTag(first[0].content));
            })
            ajax("POST", '/d_easy/deasy/api', params22, 'json', function (data) {
                var first = data.latestfuellist;
                var time = first[0].update_time;
                var years = time.slice(0, 7);
                var day = time.slice(8, 10);
                $(".news_classify_3 dt p").text(first[0].title_name);
                $(".news_classify_3 dt i").text(years);
                $(".news_classify_3 dt em").text(day);
                $(".news_classify_3 dd p").text(delHtmlTag(first[0].content));
            })
            ajax("POST", '/d_easy/deasy/api', params33, 'json', function (data) {
                var first = data.discountlist;
                var time = first[0].update_time;
                var years = time.slice(0, 7);
                var day = time.slice(8, 10);
                $(".news_classify_4 dt p").text(first[0].title_name);
                $(".news_classify_4 dt i").text(years);
                $(".news_classify_4 dt em").text(day);
                $(".news_classify_4 dd p").text(delHtmlTag(first[0].content));
            })
        })();

        //底部轮播图
        (function () {
            var swiper2 = new Swiper('.swiper-container2', {
                watchSlidesProgress: true,
                slidesPerView: 'auto',
                centeredSlides: true,
                loop: true,
                loopedSlides: 5,
                autoplay: 3000,
                paginationClickable: true,
                slideToClickedSlide: true,
                autoplayDisableOnInteraction: false,
            });
            $('.swiper-wrapper > .swiper-slide').on('mouseover', function () {
                $(this).children('.info').slideDown();
            })
            $('.swiper-wrapper > .swiper-slide').on('mouseleave', function () {
                $(this).children('.info').stop(true, false).slideUp();
            })
        })()

        //点击logo跳转到首页
        $('#iframe').on('load', function () {
            var iframe = $('#iframe').contents();
            console.log(iframe);
            iframe.find('#logo').attr('href', 'index.html');
        });
        //阻止默认事件
        $(".stop").click(function (e) {
            console.log("ok");
            e.preventDefault();
        });